{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "# Ch `09`: Concept `03`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Convolution Neural Network"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Load data from CIFAR-10."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "names ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']\n",
      "(50000, 3072) (50000,)\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import cifar_tools\n",
    "import tensorflow as tf\n",
    "\n",
    "learning_rate = 0.001\n",
    "\n",
    "names, data, labels = \\\n",
    "    cifar_tools.read_data('./cifar-10-batches-py')\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Define the placeholders and variables for the CNN model:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "x = tf.placeholder(tf.float32, [None, 24 * 24])\n",
    "y = tf.placeholder(tf.float32, [None, len(names)])\n",
    "W1 = tf.Variable(tf.random_normal([5, 5, 1, 64]))\n",
    "b1 = tf.Variable(tf.random_normal([64]))\n",
    "W2 = tf.Variable(tf.random_normal([5, 5, 64, 64]))\n",
    "b2 = tf.Variable(tf.random_normal([64]))\n",
    "W3 = tf.Variable(tf.random_normal([6*6*64, 1024]))\n",
    "b3 = tf.Variable(tf.random_normal([1024]))\n",
    "W_out = tf.Variable(tf.random_normal([1024, len(names)]))\n",
    "b_out = tf.Variable(tf.random_normal([len(names)]))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Define helper functions for the convolution and maxpool layers:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "def conv_layer(x, W, b):\n",
    "    conv = tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME')\n",
    "    conv_with_b = tf.nn.bias_add(conv, b)\n",
    "    conv_out = tf.nn.relu(conv_with_b)\n",
    "    return conv_out\n",
    "\n",
    "\n",
    "def maxpool_layer(conv, k=2):\n",
    "    return tf.nn.max_pool(conv, ksize=[1, k, k, 1], strides=[1, k, k, 1], padding='SAME')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "The CNN model is defined all within the following method:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "def model():\n",
    "    x_reshaped = tf.reshape(x, shape=[-1, 24, 24, 1])\n",
    "\n",
    "    conv_out1 = conv_layer(x_reshaped, W1, b1)\n",
    "    maxpool_out1 = maxpool_layer(conv_out1)\n",
    "    norm1 = tf.nn.lrn(maxpool_out1, 4, bias=1.0, alpha=0.001 / 9.0, beta=0.75)\n",
    "    conv_out2 = conv_layer(norm1, W2, b2)\n",
    "    norm2 = tf.nn.lrn(conv_out2, 4, bias=1.0, alpha=0.001 / 9.0, beta=0.75)\n",
    "    maxpool_out2 = maxpool_layer(norm2)\n",
    "\n",
    "    maxpool_reshaped = tf.reshape(maxpool_out2, [-1, W3.get_shape().as_list()[0]])\n",
    "    local = tf.add(tf.matmul(maxpool_reshaped, W3), b3)\n",
    "    local_out = tf.nn.relu(local)\n",
    "\n",
    "    out = tf.add(tf.matmul(local_out, W_out), b_out)\n",
    "    return out"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Here's the cost function to train the classifier."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true,
    "deletable": true,
    "editable": true
   },
   "outputs": [],
   "source": [
    "model_op = model()\n",
    "\n",
    "cost = tf.reduce_mean(\n",
    "    tf.nn.softmax_cross_entropy_with_logits(logits=model_op, labels=y)\n",
    ")\n",
    "train_op = tf.train.AdamOptimizer(learning_rate=learning_rate).minimize(cost)\n",
    "\n",
    "correct_pred = tf.equal(tf.argmax(model_op, 1), tf.argmax(y, 1))\n",
    "accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Let's train the classifier on our data:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "batch size 250\n",
      "Epoch 0. Avg accuracy 0.19152000330388547\n",
      "Epoch 1. Avg accuracy 0.25635999694466594\n",
      "Epoch 2. Avg accuracy 0.27939999781548974\n",
      "Epoch 3. Avg accuracy 0.2957199999690056\n",
      "Epoch 4. Avg accuracy 0.3054799986630678\n",
      "Epoch 5. Avg accuracy 0.3132599999010563\n",
      "Epoch 6. Avg accuracy 0.3227799978107214\n",
      "Epoch 7. Avg accuracy 0.3291599979996681\n",
      "Epoch 8. Avg accuracy 0.3335199984908104\n",
      "Epoch 9. Avg accuracy 0.34087999776005745\n",
      "Epoch 10. Avg accuracy 0.34539999842643737\n",
      "Epoch 11. Avg accuracy 0.34931999936699865\n",
      "Epoch 12. Avg accuracy 0.3532799991965294\n",
      "Epoch 13. Avg accuracy 0.35811999946832657\n",
      "Epoch 14. Avg accuracy 0.3605399985611439\n",
      "Epoch 15. Avg accuracy 0.36557999774813654\n",
      "Epoch 16. Avg accuracy 0.36623999893665315\n",
      "Epoch 17. Avg accuracy 0.3748399989306927\n",
      "Epoch 18. Avg accuracy 0.3747599983215332\n",
      "Epoch 19. Avg accuracy 0.37829999879002574\n",
      "Epoch 20. Avg accuracy 0.37785999715328217\n",
      "Epoch 21. Avg accuracy 0.38386000230908396\n",
      "Epoch 22. Avg accuracy 0.38941999807953837\n",
      "Epoch 23. Avg accuracy 0.3898999999463558\n",
      "Epoch 24. Avg accuracy 0.3935800002515316\n",
      "Epoch 25. Avg accuracy 0.38961999893188476\n",
      "Epoch 26. Avg accuracy 0.39469999879598616\n",
      "Epoch 27. Avg accuracy 0.4006799964606762\n",
      "Epoch 28. Avg accuracy 0.39600000143051145\n",
      "Epoch 29. Avg accuracy 0.3968600009381771\n",
      "Epoch 30. Avg accuracy 0.40699999913573265\n",
      "Epoch 31. Avg accuracy 0.4146400000154972\n",
      "Epoch 32. Avg accuracy 0.4208000005781651\n",
      "Epoch 33. Avg accuracy 0.42127999782562253\n",
      "Epoch 34. Avg accuracy 0.4137799996137619\n",
      "Epoch 35. Avg accuracy 0.42272000104188917\n",
      "Epoch 36. Avg accuracy 0.42284000143408773\n",
      "Epoch 37. Avg accuracy 0.4237799981236458\n",
      "Epoch 38. Avg accuracy 0.42259999573230744\n",
      "Epoch 39. Avg accuracy 0.4295799992978573\n",
      "Epoch 40. Avg accuracy 0.439019995033741\n",
      "Epoch 41. Avg accuracy 0.43277999833226205\n",
      "Epoch 42. Avg accuracy 0.4258399990200996\n",
      "Epoch 43. Avg accuracy 0.43423999920487405\n",
      "Epoch 44. Avg accuracy 0.45453999847173693\n",
      "Epoch 45. Avg accuracy 0.4394799982011318\n",
      "Epoch 46. Avg accuracy 0.4496599994599819\n",
      "Epoch 47. Avg accuracy 0.4425800010561943\n",
      "Epoch 48. Avg accuracy 0.44245999842882155\n",
      "Epoch 49. Avg accuracy 0.4350000013411045\n",
      "Epoch 50. Avg accuracy 0.4605799974501133\n",
      "Epoch 51. Avg accuracy 0.45770000010728834\n",
      "Epoch 52. Avg accuracy 0.4655199958384037\n",
      "Epoch 53. Avg accuracy 0.45325999945402146\n",
      "Epoch 54. Avg accuracy 0.4560199970006943\n",
      "Epoch 55. Avg accuracy 0.44923999786376956\n",
      "Epoch 56. Avg accuracy 0.4571200004220009\n",
      "Epoch 57. Avg accuracy 0.46137999787926676\n",
      "Epoch 58. Avg accuracy 0.4529600004851818\n",
      "Epoch 59. Avg accuracy 0.4699999974668026\n",
      "Epoch 60. Avg accuracy 0.47223999962210655\n",
      "Epoch 61. Avg accuracy 0.4652999985218048\n",
      "Epoch 62. Avg accuracy 0.49137999951839445\n",
      "Epoch 63. Avg accuracy 0.4793799975514412\n",
      "Epoch 64. Avg accuracy 0.44779999732971193\n",
      "Epoch 65. Avg accuracy 0.4812399964034557\n",
      "Epoch 66. Avg accuracy 0.49239999920129773\n",
      "Epoch 67. Avg accuracy 0.478599998652935\n",
      "Epoch 68. Avg accuracy 0.49325999662280084\n",
      "Epoch 69. Avg accuracy 0.4782799953222275\n",
      "Epoch 70. Avg accuracy 0.4667399971932173\n",
      "Epoch 71. Avg accuracy 0.4871000000834465\n",
      "Epoch 72. Avg accuracy 0.48845999941229823\n",
      "Epoch 73. Avg accuracy 0.482579997330904\n",
      "Epoch 74. Avg accuracy 0.4899399966001511\n",
      "Epoch 75. Avg accuracy 0.4825400006771088\n",
      "Epoch 76. Avg accuracy 0.45903999865055084\n",
      "Epoch 77. Avg accuracy 0.4941399945318699\n",
      "Epoch 78. Avg accuracy 0.4723799967765808\n",
      "Epoch 79. Avg accuracy 0.47193999871611597\n",
      "Epoch 80. Avg accuracy 0.5006600002944469\n",
      "Epoch 81. Avg accuracy 0.4973799967765808\n",
      "Epoch 82. Avg accuracy 0.5107199962437153\n",
      "Epoch 83. Avg accuracy 0.49781999707221986\n",
      "Epoch 84. Avg accuracy 0.4739399961382151\n",
      "Epoch 85. Avg accuracy 0.4901799973845482\n",
      "Epoch 86. Avg accuracy 0.494079999178648\n",
      "Epoch 87. Avg accuracy 0.5053799973428249\n",
      "Epoch 88. Avg accuracy 0.4824999986588955\n",
      "Epoch 89. Avg accuracy 0.5010399955511093\n",
      "Epoch 90. Avg accuracy 0.501519999653101\n",
      "Epoch 91. Avg accuracy 0.5046400001645088\n",
      "Epoch 92. Avg accuracy 0.51563999786973\n",
      "Epoch 93. Avg accuracy 0.501779995560646\n",
      "Epoch 94. Avg accuracy 0.5378999970853329\n",
      "Epoch 95. Avg accuracy 0.5078599965572357\n",
      "Epoch 96. Avg accuracy 0.5187199999392033\n",
      "Epoch 97. Avg accuracy 0.4921999979019165\n",
      "Epoch 98. Avg accuracy 0.500859996676445\n",
      "Epoch 99. Avg accuracy 0.5020599972456694\n",
      "Epoch 100. Avg accuracy 0.5271399988234043\n",
      "Epoch 101. Avg accuracy 0.5261799983680249\n",
      "Epoch 102. Avg accuracy 0.4799199987202883\n",
      "Epoch 103. Avg accuracy 0.5283999967575074\n",
      "Epoch 104. Avg accuracy 0.5205199982225895\n",
      "Epoch 105. Avg accuracy 0.5397799986600876\n",
      "Epoch 106. Avg accuracy 0.5293599992990494\n",
      "Epoch 107. Avg accuracy 0.5168799953907728\n",
      "Epoch 108. Avg accuracy 0.5129999995231629\n",
      "Epoch 109. Avg accuracy 0.5318599927425385\n",
      "Epoch 110. Avg accuracy 0.5456999972462654\n",
      "Epoch 111. Avg accuracy 0.5599399994313717\n",
      "Epoch 112. Avg accuracy 0.49951999880373477\n",
      "Epoch 113. Avg accuracy 0.4951799981296062\n",
      "Epoch 114. Avg accuracy 0.527620000243187\n",
      "Epoch 115. Avg accuracy 0.5099799961596727\n",
      "Epoch 116. Avg accuracy 0.5317799977958202\n",
      "Epoch 117. Avg accuracy 0.5215399979054928\n",
      "Epoch 118. Avg accuracy 0.5327199956774712\n",
      "Epoch 119. Avg accuracy 0.5513999971747399\n",
      "Epoch 120. Avg accuracy 0.4843400011211634\n",
      "Epoch 121. Avg accuracy 0.5326199966669083\n",
      "Epoch 122. Avg accuracy 0.5253799952566623\n",
      "Epoch 123. Avg accuracy 0.5332999940216542\n",
      "Epoch 124. Avg accuracy 0.5580000002682209\n",
      "Epoch 125. Avg accuracy 0.5529399952292442\n",
      "Epoch 126. Avg accuracy 0.5781199970841407\n",
      "Epoch 127. Avg accuracy 0.5222799986600876\n",
      "Epoch 128. Avg accuracy 0.5226199966669083\n",
      "Epoch 129. Avg accuracy 0.5437399984896183\n",
      "Epoch 130. Avg accuracy 0.5438599994778633\n",
      "Epoch 131. Avg accuracy 0.5345199979841709\n",
      "Epoch 132. Avg accuracy 0.5242400000989437\n",
      "Epoch 133. Avg accuracy 0.5107999947667122\n",
      "Epoch 134. Avg accuracy 0.5565799941122532\n",
      "Epoch 135. Avg accuracy 0.5224399976432323\n",
      "Epoch 136. Avg accuracy 0.5447399939596653\n",
      "Epoch 137. Avg accuracy 0.5590399943292141\n",
      "Epoch 138. Avg accuracy 0.5344599983096123\n",
      "Epoch 139. Avg accuracy 0.5291199944913387\n",
      "Epoch 140. Avg accuracy 0.5533999975025654\n",
      "Epoch 141. Avg accuracy 0.5414599953591823\n",
      "Epoch 142. Avg accuracy 0.5496599976718426\n",
      "Epoch 143. Avg accuracy 0.5816399915516377\n",
      "Epoch 144. Avg accuracy 0.5833599978685379\n",
      "Epoch 145. Avg accuracy 0.5322200007736683\n",
      "Epoch 146. Avg accuracy 0.5253999957442284\n",
      "Epoch 147. Avg accuracy 0.5666399930417537\n",
      "Epoch 148. Avg accuracy 0.5283999980986118\n",
      "Epoch 149. Avg accuracy 0.5535799960792065\n",
      "Epoch 150. Avg accuracy 0.5665999981760979\n",
      "Epoch 151. Avg accuracy 0.5433599951863289\n",
      "Epoch 152. Avg accuracy 0.567879992723465\n",
      "Epoch 153. Avg accuracy 0.5500199970602989\n",
      "Epoch 154. Avg accuracy 0.5661599959433079\n",
      "Epoch 155. Avg accuracy 0.5481199991703033\n",
      "Epoch 156. Avg accuracy 0.5359799955785275\n",
      "Epoch 157. Avg accuracy 0.5528799940645694\n",
      "Epoch 158. Avg accuracy 0.5410199955105781\n",
      "Epoch 159. Avg accuracy 0.542959995791316\n",
      "Epoch 160. Avg accuracy 0.5548399993777275\n",
      "Epoch 161. Avg accuracy 0.5508399972319603\n",
      "Epoch 162. Avg accuracy 0.5830599945783616\n",
      "Epoch 163. Avg accuracy 0.6013999958336353\n",
      "Epoch 164. Avg accuracy 0.5715199959278107\n",
      "Epoch 165. Avg accuracy 0.5747599969804287\n",
      "Epoch 166. Avg accuracy 0.5931599995493889\n",
      "Epoch 167. Avg accuracy 0.5731999942660332\n",
      "Epoch 168. Avg accuracy 0.6031799975037575\n",
      "Epoch 169. Avg accuracy 0.5626599973440171\n",
      "Epoch 170. Avg accuracy 0.5946199947595596\n",
      "Epoch 171. Avg accuracy 0.5860399955511093\n",
      "Epoch 172. Avg accuracy 0.5914599938690662\n",
      "Epoch 173. Avg accuracy 0.5518600001931191\n",
      "Epoch 174. Avg accuracy 0.5821199955046177\n",
      "Epoch 175. Avg accuracy 0.5536199955642224\n",
      "Epoch 176. Avg accuracy 0.5940399977564812\n",
      "Epoch 177. Avg accuracy 0.577959995418787\n",
      "Epoch 178. Avg accuracy 0.5755799977481365\n",
      "Epoch 179. Avg accuracy 0.5637999987602234\n",
      "Epoch 180. Avg accuracy 0.5551999971270561\n",
      "Epoch 181. Avg accuracy 0.5911799953877925\n",
      "Epoch 182. Avg accuracy 0.580479996651411\n",
      "Epoch 183. Avg accuracy 0.6009799946844577\n",
      "Epoch 184. Avg accuracy 0.5820199991762638\n",
      "Epoch 185. Avg accuracy 0.6011199951171875\n",
      "Epoch 186. Avg accuracy 0.5330599921941758\n",
      "Epoch 187. Avg accuracy 0.5640599942207336\n",
      "Epoch 188. Avg accuracy 0.5529399959743023\n",
      "Epoch 189. Avg accuracy 0.5689599943161011\n",
      "Epoch 190. Avg accuracy 0.5685799977183342\n",
      "Epoch 191. Avg accuracy 0.5718999914824963\n",
      "Epoch 192. Avg accuracy 0.5605199961364269\n",
      "Epoch 193. Avg accuracy 0.5662199929356575\n",
      "Epoch 194. Avg accuracy 0.5738199989497662\n",
      "Epoch 195. Avg accuracy 0.5827199973165988\n",
      "Epoch 196. Avg accuracy 0.586220000833273\n",
      "Epoch 197. Avg accuracy 0.5601199990510941\n",
      "Epoch 198. Avg accuracy 0.5645599961280823\n",
      "Epoch 199. Avg accuracy 0.5497999942302704\n",
      "Epoch 200. Avg accuracy 0.5653799968957901\n",
      "Epoch 201. Avg accuracy 0.5894600003957748\n",
      "Epoch 202. Avg accuracy 0.5581599971652031\n",
      "Epoch 203. Avg accuracy 0.5851999932527542\n",
      "Epoch 204. Avg accuracy 0.6116199980676175\n",
      "Epoch 205. Avg accuracy 0.6088199964165688\n",
      "Epoch 206. Avg accuracy 0.622379994392395\n",
      "Epoch 207. Avg accuracy 0.5928199915587902\n",
      "Epoch 208. Avg accuracy 0.6192599944770336\n",
      "Epoch 209. Avg accuracy 0.632919999063015\n",
      "Epoch 210. Avg accuracy 0.5906599968671798\n",
      "Epoch 211. Avg accuracy 0.6005399991571904\n",
      "Epoch 212. Avg accuracy 0.6336200001835823\n",
      "Epoch 213. Avg accuracy 0.5849199968576432\n",
      "Epoch 214. Avg accuracy 0.5948599947988987\n",
      "Epoch 215. Avg accuracy 0.6128199960291386\n",
      "Epoch 216. Avg accuracy 0.6254199989140033\n",
      "Epoch 217. Avg accuracy 0.5968399976193904\n",
      "Epoch 218. Avg accuracy 0.620299996137619\n",
      "Epoch 219. Avg accuracy 0.5875999988615512\n",
      "Epoch 220. Avg accuracy 0.6144599990546703\n",
      "Epoch 221. Avg accuracy 0.630899995714426\n",
      "Epoch 222. Avg accuracy 0.6335399994254112\n",
      "Epoch 223. Avg accuracy 0.5501199960708618\n",
      "Epoch 224. Avg accuracy 0.5843999956548214\n",
      "Epoch 225. Avg accuracy 0.5937799951434135\n",
      "Epoch 226. Avg accuracy 0.5943599933385849\n",
      "Epoch 227. Avg accuracy 0.5693999959528446\n",
      "Epoch 228. Avg accuracy 0.5859399969875813\n",
      "Epoch 229. Avg accuracy 0.603959991633892\n",
      "Epoch 230. Avg accuracy 0.5977399957180023\n",
      "Epoch 231. Avg accuracy 0.5766199961304664\n",
      "Epoch 232. Avg accuracy 0.5743199999630452\n",
      "Epoch 233. Avg accuracy 0.5927399991452694\n",
      "Epoch 234. Avg accuracy 0.6012999980151653\n",
      "Epoch 235. Avg accuracy 0.6017399939894676\n",
      "Epoch 236. Avg accuracy 0.5800199925899505\n",
      "Epoch 237. Avg accuracy 0.6192199984192848\n",
      "Epoch 238. Avg accuracy 0.6299799990653991\n",
      "Epoch 239. Avg accuracy 0.6087399968504905\n",
      "Epoch 240. Avg accuracy 0.6266399943828582\n",
      "Epoch 241. Avg accuracy 0.5738999941945075\n",
      "Epoch 242. Avg accuracy 0.5826799963414669\n",
      "Epoch 243. Avg accuracy 0.5789199981093407\n",
      "Epoch 244. Avg accuracy 0.5846199981868268\n",
      "Epoch 245. Avg accuracy 0.5872199946641922\n",
      "Epoch 246. Avg accuracy 0.5855399996042252\n",
      "Epoch 247. Avg accuracy 0.5819399972259999\n",
      "Epoch 248. Avg accuracy 0.6038199949264527\n",
      "Epoch 249. Avg accuracy 0.5993399941921234\n",
      "Epoch 250. Avg accuracy 0.5839999975264072\n",
      "Epoch 251. Avg accuracy 0.5798399935662747\n",
      "Epoch 252. Avg accuracy 0.5921600012481213\n",
      "Epoch 253. Avg accuracy 0.6095599968731403\n",
      "Epoch 254. Avg accuracy 0.6143199987709522\n",
      "Epoch 255. Avg accuracy 0.6363199964165688\n",
      "Epoch 256. Avg accuracy 0.6227599953114986\n",
      "Epoch 257. Avg accuracy 0.6034799967706204\n",
      "Epoch 258. Avg accuracy 0.6045799987018108\n",
      "Epoch 259. Avg accuracy 0.6127999949455262\n",
      "Epoch 260. Avg accuracy 0.5950399972498417\n",
      "Epoch 261. Avg accuracy 0.58245999366045\n",
      "Epoch 262. Avg accuracy 0.5909999977052212\n",
      "Epoch 263. Avg accuracy 0.5955800004303455\n",
      "Epoch 264. Avg accuracy 0.5973199969530105\n",
      "Epoch 265. Avg accuracy 0.6055800005793571\n",
      "Epoch 266. Avg accuracy 0.616819996535778\n",
      "Epoch 267. Avg accuracy 0.6078399983048439\n",
      "Epoch 268. Avg accuracy 0.618799998909235\n",
      "Epoch 269. Avg accuracy 0.6181999960541725\n",
      "Epoch 270. Avg accuracy 0.6321800011396408\n",
      "Epoch 271. Avg accuracy 0.6491599988937378\n",
      "Epoch 272. Avg accuracy 0.6465799988806248\n",
      "Epoch 273. Avg accuracy 0.6675199988484383\n",
      "Epoch 274. Avg accuracy 0.654519998729229\n",
      "Epoch 275. Avg accuracy 0.6692999947071075\n",
      "Epoch 276. Avg accuracy 0.6690399995446206\n",
      "Epoch 277. Avg accuracy 0.6556799957156181\n",
      "Epoch 278. Avg accuracy 0.6749199977517129\n",
      "Epoch 279. Avg accuracy 0.6590200018882751\n",
      "Epoch 280. Avg accuracy 0.6235599973797799\n",
      "Epoch 281. Avg accuracy 0.6397399997711182\n",
      "Epoch 282. Avg accuracy 0.6547400014102459\n",
      "Epoch 283. Avg accuracy 0.6683200010657311\n",
      "Epoch 284. Avg accuracy 0.6488599948585033\n",
      "Epoch 285. Avg accuracy 0.6649999994039536\n",
      "Epoch 286. Avg accuracy 0.6385199965536594\n",
      "Epoch 287. Avg accuracy 0.6640399993956089\n",
      "Epoch 288. Avg accuracy 0.6624199992418289\n",
      "Epoch 289. Avg accuracy 0.6479800044000149\n",
      "Epoch 290. Avg accuracy 0.6452399970591068\n",
      "Epoch 291. Avg accuracy 0.6459199965000153\n",
      "Epoch 292. Avg accuracy 0.623419998139143\n",
      "Epoch 293. Avg accuracy 0.6451599974930287\n",
      "Epoch 294. Avg accuracy 0.651900002360344\n",
      "Epoch 295. Avg accuracy 0.650379998087883\n",
      "Epoch 296. Avg accuracy 0.6632599997520446\n",
      "Epoch 297. Avg accuracy 0.6301399970054626\n",
      "Epoch 298. Avg accuracy 0.6265799935162067\n",
      "Epoch 299. Avg accuracy 0.623239996433258\n",
      "Epoch 300. Avg accuracy 0.613899995982647\n",
      "Epoch 301. Avg accuracy 0.6078999924659729\n",
      "Epoch 302. Avg accuracy 0.6051599933207035\n",
      "Epoch 303. Avg accuracy 0.5826399967074394\n",
      "Epoch 304. Avg accuracy 0.5947599948942661\n",
      "Epoch 305. Avg accuracy 0.5930399969220161\n",
      "Epoch 306. Avg accuracy 0.606919989734888\n",
      "Epoch 307. Avg accuracy 0.6123799945414067\n",
      "Epoch 308. Avg accuracy 0.6110399992763996\n",
      "Epoch 309. Avg accuracy 0.6119799947738648\n",
      "Epoch 310. Avg accuracy 0.622119999974966\n",
      "Epoch 311. Avg accuracy 0.6262999981641769\n",
      "Epoch 312. Avg accuracy 0.6260799975693225\n",
      "Epoch 313. Avg accuracy 0.6283599995076656\n",
      "Epoch 314. Avg accuracy 0.6256599943339824\n",
      "Epoch 315. Avg accuracy 0.6552799978852272\n",
      "Epoch 316. Avg accuracy 0.656999998241663\n",
      "Epoch 317. Avg accuracy 0.6649599999189377\n",
      "Epoch 318. Avg accuracy 0.6725999996066093\n",
      "Epoch 319. Avg accuracy 0.6774400010704994\n",
      "Epoch 320. Avg accuracy 0.6719999974966049\n",
      "Epoch 321. Avg accuracy 0.6745000015199184\n",
      "Epoch 322. Avg accuracy 0.6808799982070923\n",
      "Epoch 323. Avg accuracy 0.6891800007224083\n",
      "Epoch 324. Avg accuracy 0.6921200060844421\n",
      "Epoch 325. Avg accuracy 0.6912000039219857\n",
      "Epoch 326. Avg accuracy 0.6967200028896332\n",
      "Epoch 327. Avg accuracy 0.6906000000238418\n",
      "Epoch 328. Avg accuracy 0.6811400064826012\n",
      "Epoch 329. Avg accuracy 0.6624599966406822\n",
      "Epoch 330. Avg accuracy 0.648239999115467\n",
      "Epoch 331. Avg accuracy 0.6811400076746941\n",
      "Epoch 332. Avg accuracy 0.6967399999499321\n",
      "Epoch 333. Avg accuracy 0.6740600000321865\n",
      "Epoch 334. Avg accuracy 0.6703399974107742\n",
      "Epoch 335. Avg accuracy 0.6629199960827827\n",
      "Epoch 336. Avg accuracy 0.648839997947216\n",
      "Epoch 337. Avg accuracy 0.6311599950492383\n",
      "Epoch 338. Avg accuracy 0.6274799962341785\n",
      "Epoch 339. Avg accuracy 0.6105599984526634\n",
      "Epoch 340. Avg accuracy 0.6045399962365627\n",
      "Epoch 341. Avg accuracy 0.6058399976789951\n",
      "Epoch 342. Avg accuracy 0.6170199961960315\n",
      "Epoch 343. Avg accuracy 0.622039997279644\n",
      "Epoch 344. Avg accuracy 0.6210200001299381\n",
      "Epoch 345. Avg accuracy 0.6316799978911877\n",
      "Epoch 346. Avg accuracy 0.6319799917936325\n",
      "Epoch 347. Avg accuracy 0.6334800004959107\n",
      "Epoch 348. Avg accuracy 0.6480999955534935\n",
      "Epoch 349. Avg accuracy 0.6473999974131585\n",
      "Epoch 350. Avg accuracy 0.6451400011777878\n",
      "Epoch 351. Avg accuracy 0.6446399964392185\n",
      "Epoch 352. Avg accuracy 0.628499997407198\n",
      "Epoch 353. Avg accuracy 0.6204799962043762\n",
      "Epoch 354. Avg accuracy 0.6361599941551686\n",
      "Epoch 355. Avg accuracy 0.6276399992406368\n",
      "Epoch 356. Avg accuracy 0.6328999954462051\n",
      "Epoch 357. Avg accuracy 0.6330199986696243\n",
      "Epoch 358. Avg accuracy 0.6331999956071377\n",
      "Epoch 359. Avg accuracy 0.6553599938750267\n",
      "Epoch 360. Avg accuracy 0.6666000030934811\n",
      "Epoch 361. Avg accuracy 0.6844000032544136\n",
      "Epoch 362. Avg accuracy 0.6982200038433075\n",
      "Epoch 363. Avg accuracy 0.7145000040531159\n",
      "Epoch 364. Avg accuracy 0.7064200028777122\n",
      "Epoch 365. Avg accuracy 0.6835800041258335\n",
      "Epoch 366. Avg accuracy 0.709840005338192\n",
      "Epoch 367. Avg accuracy 0.7150800025463104\n",
      "Epoch 368. Avg accuracy 0.6880200010538101\n",
      "Epoch 369. Avg accuracy 0.710280000269413\n",
      "Epoch 370. Avg accuracy 0.7161400040984154\n",
      "Epoch 371. Avg accuracy 0.7160600048303604\n",
      "Epoch 372. Avg accuracy 0.7232000061869621\n",
      "Epoch 373. Avg accuracy 0.696560001373291\n",
      "Epoch 374. Avg accuracy 0.7113199999928475\n",
      "Epoch 375. Avg accuracy 0.7245400032401085\n",
      "Epoch 376. Avg accuracy 0.7070600032806397\n",
      "Epoch 377. Avg accuracy 0.6982600021362305\n",
      "Epoch 378. Avg accuracy 0.6889399999380111\n",
      "Epoch 379. Avg accuracy 0.6755800013244152\n",
      "Epoch 380. Avg accuracy 0.6827000057697297\n",
      "Epoch 381. Avg accuracy 0.6669999979436397\n",
      "Epoch 382. Avg accuracy 0.6566400018334388\n",
      "Epoch 383. Avg accuracy 0.657580001950264\n",
      "Epoch 384. Avg accuracy 0.6500200015306473\n",
      "Epoch 385. Avg accuracy 0.643719996213913\n",
      "Epoch 386. Avg accuracy 0.6468200013041496\n",
      "Epoch 387. Avg accuracy 0.6464599986374379\n",
      "Epoch 388. Avg accuracy 0.6453799958527088\n",
      "Epoch 389. Avg accuracy 0.633259996920824\n",
      "Epoch 390. Avg accuracy 0.6363599982857704\n",
      "Epoch 391. Avg accuracy 0.645020001232624\n",
      "Epoch 392. Avg accuracy 0.6335999990999699\n",
      "Epoch 393. Avg accuracy 0.64391999989748\n",
      "Epoch 394. Avg accuracy 0.6674400025606155\n",
      "Epoch 395. Avg accuracy 0.666739998459816\n",
      "Epoch 396. Avg accuracy 0.661239997446537\n",
      "Epoch 397. Avg accuracy 0.689960001707077\n",
      "Epoch 398. Avg accuracy 0.6969200026988983\n",
      "Epoch 399. Avg accuracy 0.7059000033140183\n",
      "Epoch 400. Avg accuracy 0.7118000027537346\n",
      "Epoch 401. Avg accuracy 0.7153600084781647\n",
      "Epoch 402. Avg accuracy 0.7111800023913384\n",
      "Epoch 403. Avg accuracy 0.7210200056433678\n",
      "Epoch 404. Avg accuracy 0.7337200078368187\n",
      "Epoch 405. Avg accuracy 0.7112600065767765\n",
      "Epoch 406. Avg accuracy 0.7271800023317337\n",
      "Epoch 407. Avg accuracy 0.7350200054049492\n",
      "Epoch 408. Avg accuracy 0.7321000051498413\n",
      "Epoch 409. Avg accuracy 0.7260200078785419\n",
      "Epoch 410. Avg accuracy 0.738000003695488\n",
      "Epoch 411. Avg accuracy 0.7322400015592575\n",
      "Epoch 412. Avg accuracy 0.7267600086331367\n",
      "Epoch 413. Avg accuracy 0.7302600055932998\n",
      "Epoch 414. Avg accuracy 0.7316600078344345\n",
      "Epoch 415. Avg accuracy 0.7218600025773049\n",
      "Epoch 416. Avg accuracy 0.6996000030636788\n",
      "Epoch 417. Avg accuracy 0.6877600023150444\n",
      "Epoch 418. Avg accuracy 0.6919400025904179\n",
      "Epoch 419. Avg accuracy 0.676080002784729\n",
      "Epoch 420. Avg accuracy 0.6642000004649162\n",
      "Epoch 421. Avg accuracy 0.6611399991810322\n",
      "Epoch 422. Avg accuracy 0.6485399967432022\n",
      "Epoch 423. Avg accuracy 0.6540799984335899\n",
      "Epoch 424. Avg accuracy 0.6557400006055832\n",
      "Epoch 425. Avg accuracy 0.6556799975037575\n",
      "Epoch 426. Avg accuracy 0.6530599993467331\n",
      "Epoch 427. Avg accuracy 0.6515999989211559\n",
      "Epoch 428. Avg accuracy 0.6687599992752076\n",
      "Epoch 429. Avg accuracy 0.6693199959397316\n",
      "Epoch 430. Avg accuracy 0.6740999975800515\n",
      "Epoch 431. Avg accuracy 0.6935400021076202\n",
      "Epoch 432. Avg accuracy 0.6920199981331825\n",
      "Epoch 433. Avg accuracy 0.6916600069403649\n",
      "Epoch 434. Avg accuracy 0.6883600029349327\n",
      "Epoch 435. Avg accuracy 0.699860003888607\n",
      "Epoch 436. Avg accuracy 0.6905400006473065\n",
      "Epoch 437. Avg accuracy 0.6984600025415421\n",
      "Epoch 438. Avg accuracy 0.7044400015473365\n",
      "Epoch 439. Avg accuracy 0.7020600038766861\n",
      "Epoch 440. Avg accuracy 0.70274000197649\n",
      "Epoch 441. Avg accuracy 0.7022000035643577\n",
      "Epoch 442. Avg accuracy 0.7059000018239021\n",
      "Epoch 443. Avg accuracy 0.7011400049924851\n",
      "Epoch 444. Avg accuracy 0.6959800073504447\n",
      "Epoch 445. Avg accuracy 0.6811000016331673\n",
      "Epoch 446. Avg accuracy 0.6764800021052361\n",
      "Epoch 447. Avg accuracy 0.6763800022006035\n",
      "Epoch 448. Avg accuracy 0.6696599997580052\n",
      "Epoch 449. Avg accuracy 0.670519999563694\n",
      "Epoch 450. Avg accuracy 0.6847799998521805\n",
      "Epoch 451. Avg accuracy 0.6912400010228157\n",
      "Epoch 452. Avg accuracy 0.7012400034070015\n",
      "Epoch 453. Avg accuracy 0.7057000038027763\n",
      "Epoch 454. Avg accuracy 0.7195400083065033\n",
      "Epoch 455. Avg accuracy 0.7242400053143502\n",
      "Epoch 456. Avg accuracy 0.7309800034761429\n",
      "Epoch 457. Avg accuracy 0.7398800083994865\n",
      "Epoch 458. Avg accuracy 0.7423600053787232\n",
      "Epoch 459. Avg accuracy 0.7495200079679489\n",
      "Epoch 460. Avg accuracy 0.7476400083303452\n",
      "Epoch 461. Avg accuracy 0.7589200112223625\n",
      "Epoch 462. Avg accuracy 0.7663000085949898\n",
      "Epoch 463. Avg accuracy 0.7612600052356719\n",
      "Epoch 464. Avg accuracy 0.7646800124645233\n",
      "Epoch 465. Avg accuracy 0.7621200105547905\n",
      "Epoch 466. Avg accuracy 0.764640007019043\n",
      "Epoch 467. Avg accuracy 0.7681600096821785\n",
      "Epoch 468. Avg accuracy 0.7730800077319145\n",
      "Epoch 469. Avg accuracy 0.7749200117588043\n",
      "Epoch 470. Avg accuracy 0.7657800105214119\n",
      "Epoch 471. Avg accuracy 0.7742400136590004\n",
      "Epoch 472. Avg accuracy 0.7545000052452088\n",
      "Epoch 473. Avg accuracy 0.7674400076270104\n",
      "Epoch 474. Avg accuracy 0.7727600112557411\n",
      "Epoch 475. Avg accuracy 0.758820007443428\n",
      "Epoch 476. Avg accuracy 0.7445800122618675\n",
      "Epoch 477. Avg accuracy 0.7396400064229965\n",
      "Epoch 478. Avg accuracy 0.734660005569458\n",
      "Epoch 479. Avg accuracy 0.7308000048995018\n",
      "Epoch 480. Avg accuracy 0.7149200087785721\n",
      "Epoch 481. Avg accuracy 0.7146199995279312\n",
      "Epoch 482. Avg accuracy 0.709200002849102\n",
      "Epoch 483. Avg accuracy 0.7007200023531914\n",
      "Epoch 484. Avg accuracy 0.6950800004601478\n",
      "Epoch 485. Avg accuracy 0.6772000017762184\n",
      "Epoch 486. Avg accuracy 0.6810000003874301\n",
      "Epoch 487. Avg accuracy 0.6827200016379357\n",
      "Epoch 488. Avg accuracy 0.6913399946689606\n",
      "Epoch 489. Avg accuracy 0.6944600030779838\n",
      "Epoch 490. Avg accuracy 0.7043400001525879\n",
      "Epoch 491. Avg accuracy 0.6968599992990494\n",
      "Epoch 492. Avg accuracy 0.6948800027370453\n",
      "Epoch 493. Avg accuracy 0.7061000055074692\n",
      "Epoch 494. Avg accuracy 0.7191200056672096\n",
      "Epoch 495. Avg accuracy 0.7158600074052811\n",
      "Epoch 496. Avg accuracy 0.7135200083255768\n",
      "Epoch 497. Avg accuracy 0.706240001320839\n",
      "Epoch 498. Avg accuracy 0.7019400066137313\n",
      "Epoch 499. Avg accuracy 0.7028600001335144\n",
      "Epoch 500. Avg accuracy 0.7014600023627281\n",
      "Epoch 501. Avg accuracy 0.6983200007677078\n",
      "Epoch 502. Avg accuracy 0.7014400088787078\n",
      "Epoch 503. Avg accuracy 0.6923000013828278\n",
      "Epoch 504. Avg accuracy 0.6966400042176246\n",
      "Epoch 505. Avg accuracy 0.695620000064373\n",
      "Epoch 506. Avg accuracy 0.7027200040221214\n",
      "Epoch 507. Avg accuracy 0.70990000218153\n",
      "Epoch 508. Avg accuracy 0.7124400016665459\n",
      "Epoch 509. Avg accuracy 0.7194400051236153\n",
      "Epoch 510. Avg accuracy 0.7281800073385238\n",
      "Epoch 511. Avg accuracy 0.729320003092289\n",
      "Epoch 512. Avg accuracy 0.736600005030632\n",
      "Epoch 513. Avg accuracy 0.7404400044679642\n",
      "Epoch 514. Avg accuracy 0.7457400101423264\n",
      "Epoch 515. Avg accuracy 0.7533200117945671\n",
      "Epoch 516. Avg accuracy 0.7605800086259842\n",
      "Epoch 517. Avg accuracy 0.7626400086283683\n",
      "Epoch 518. Avg accuracy 0.7756200045347214\n",
      "Epoch 519. Avg accuracy 0.7803200072050095\n",
      "Epoch 520. Avg accuracy 0.7839400139451027\n",
      "Epoch 521. Avg accuracy 0.7828400111198426\n",
      "Epoch 522. Avg accuracy 0.7878000074625016\n",
      "Epoch 523. Avg accuracy 0.7763400080800057\n",
      "Epoch 524. Avg accuracy 0.7769200086593628\n",
      "Epoch 525. Avg accuracy 0.7784400114417076\n",
      "Epoch 526. Avg accuracy 0.7649600052833557\n",
      "Epoch 527. Avg accuracy 0.7715400078892708\n",
      "Epoch 528. Avg accuracy 0.7575600072741508\n",
      "Epoch 529. Avg accuracy 0.7632200071215629\n",
      "Epoch 530. Avg accuracy 0.743720006942749\n",
      "Epoch 531. Avg accuracy 0.7472000107169151\n",
      "Epoch 532. Avg accuracy 0.7398000046610832\n",
      "Epoch 533. Avg accuracy 0.7312400063872337\n",
      "Epoch 534. Avg accuracy 0.7331600052118301\n",
      "Epoch 535. Avg accuracy 0.7226200079917908\n",
      "Epoch 536. Avg accuracy 0.7242400074005126\n",
      "Epoch 537. Avg accuracy 0.7108600050210953\n",
      "Epoch 538. Avg accuracy 0.7046200042963028\n",
      "Epoch 539. Avg accuracy 0.700020002424717\n",
      "Epoch 540. Avg accuracy 0.6913200044631957\n",
      "Epoch 541. Avg accuracy 0.6990400001406669\n",
      "Epoch 542. Avg accuracy 0.7057400041818619\n",
      "Epoch 543. Avg accuracy 0.7129400005936622\n",
      "Epoch 544. Avg accuracy 0.7202600058913231\n",
      "Epoch 545. Avg accuracy 0.7237600049376488\n",
      "Epoch 546. Avg accuracy 0.7166200059652329\n",
      "Epoch 547. Avg accuracy 0.715960003733635\n",
      "Epoch 548. Avg accuracy 0.7267200070619583\n",
      "Epoch 549. Avg accuracy 0.7351400047540665\n",
      "Epoch 550. Avg accuracy 0.7406600016355515\n",
      "Epoch 551. Avg accuracy 0.7510000053048134\n",
      "Epoch 552. Avg accuracy 0.7589600098133087\n",
      "Epoch 553. Avg accuracy 0.763720001578331\n",
      "Epoch 554. Avg accuracy 0.7690400114655495\n",
      "Epoch 555. Avg accuracy 0.777200009226799\n",
      "Epoch 556. Avg accuracy 0.7788200089335442\n",
      "Epoch 557. Avg accuracy 0.7824600097537041\n",
      "Epoch 558. Avg accuracy 0.7866400110721589\n",
      "Epoch 559. Avg accuracy 0.792700012922287\n",
      "Epoch 560. Avg accuracy 0.7981000101566315\n",
      "Epoch 561. Avg accuracy 0.8016600075364113\n",
      "Epoch 562. Avg accuracy 0.8022600090503693\n",
      "Epoch 563. Avg accuracy 0.800760004222393\n",
      "Epoch 564. Avg accuracy 0.8042200073599816\n",
      "Epoch 565. Avg accuracy 0.8094600075483322\n",
      "Epoch 566. Avg accuracy 0.8078800043463708\n",
      "Epoch 567. Avg accuracy 0.8100800108909607\n",
      "Epoch 568. Avg accuracy 0.8085600101947784\n",
      "Epoch 569. Avg accuracy 0.8124200069904327\n",
      "Epoch 570. Avg accuracy 0.8055000111460686\n",
      "Epoch 571. Avg accuracy 0.806400009393692\n",
      "Epoch 572. Avg accuracy 0.8076400083303451\n",
      "Epoch 573. Avg accuracy 0.8077000126242637\n",
      "Epoch 574. Avg accuracy 0.8049600079655648\n",
      "Epoch 575. Avg accuracy 0.8023600077629089\n",
      "Epoch 576. Avg accuracy 0.7841800072789192\n",
      "Epoch 577. Avg accuracy 0.7782000079751015\n",
      "Epoch 578. Avg accuracy 0.7683000072836876\n",
      "Epoch 579. Avg accuracy 0.764680010676384\n",
      "Epoch 580. Avg accuracy 0.7594400110840798\n",
      "Epoch 581. Avg accuracy 0.75960000872612\n",
      "Epoch 582. Avg accuracy 0.7495000076293945\n",
      "Epoch 583. Avg accuracy 0.7342400059103966\n",
      "Epoch 584. Avg accuracy 0.7375800094008446\n",
      "Epoch 585. Avg accuracy 0.7381200098991394\n",
      "Epoch 586. Avg accuracy 0.7361200073361397\n",
      "Epoch 587. Avg accuracy 0.7429600059986115\n",
      "Epoch 588. Avg accuracy 0.7500800111889839\n",
      "Epoch 589. Avg accuracy 0.7573800060153008\n",
      "Epoch 590. Avg accuracy 0.7661000135540962\n",
      "Epoch 591. Avg accuracy 0.7664400061964989\n",
      "Epoch 592. Avg accuracy 0.7584600093960762\n",
      "Epoch 593. Avg accuracy 0.7587600108981133\n",
      "Epoch 594. Avg accuracy 0.7584600108861923\n",
      "Epoch 595. Avg accuracy 0.7445600041747094\n",
      "Epoch 596. Avg accuracy 0.7530200058221816\n",
      "Epoch 597. Avg accuracy 0.7605000078678131\n",
      "Epoch 598. Avg accuracy 0.7694800055027008\n",
      "Epoch 599. Avg accuracy 0.7799000099301339\n",
      "Epoch 600. Avg accuracy 0.7838400045037269\n",
      "Epoch 601. Avg accuracy 0.7856400075554848\n",
      "Epoch 602. Avg accuracy 0.7985400089621544\n",
      "Epoch 603. Avg accuracy 0.8066000124812126\n",
      "Epoch 604. Avg accuracy 0.81118000715971\n",
      "Epoch 605. Avg accuracy 0.8207000097632409\n",
      "Epoch 606. Avg accuracy 0.8276400056481361\n",
      "Epoch 607. Avg accuracy 0.8293200129270554\n",
      "Epoch 608. Avg accuracy 0.8345400092005729\n",
      "Epoch 609. Avg accuracy 0.8349000060558319\n",
      "Epoch 610. Avg accuracy 0.8321800118684769\n",
      "Epoch 611. Avg accuracy 0.835580008327961\n",
      "Epoch 612. Avg accuracy 0.8349600094556808\n",
      "Epoch 613. Avg accuracy 0.8360800084471702\n",
      "Epoch 614. Avg accuracy 0.8305000111460685\n",
      "Epoch 615. Avg accuracy 0.8347000104188919\n",
      "Epoch 616. Avg accuracy 0.8289200076460839\n",
      "Epoch 617. Avg accuracy 0.8339600059390068\n",
      "Epoch 618. Avg accuracy 0.8240400084853172\n",
      "Epoch 619. Avg accuracy 0.822180007994175\n",
      "Epoch 620. Avg accuracy 0.8179800096154213\n",
      "Epoch 621. Avg accuracy 0.8143800124526024\n",
      "Epoch 622. Avg accuracy 0.8029800099134445\n",
      "Epoch 623. Avg accuracy 0.7942600107192993\n",
      "Epoch 624. Avg accuracy 0.7918600091338157\n",
      "Epoch 625. Avg accuracy 0.793380012512207\n",
      "Epoch 626. Avg accuracy 0.794520013332367\n",
      "Epoch 627. Avg accuracy 0.796620012819767\n",
      "Epoch 628. Avg accuracy 0.7925600123405456\n",
      "Epoch 629. Avg accuracy 0.789940005838871\n",
      "Epoch 630. Avg accuracy 0.7819200071692467\n",
      "Epoch 631. Avg accuracy 0.7848200035095215\n",
      "Epoch 632. Avg accuracy 0.773140005171299\n",
      "Epoch 633. Avg accuracy 0.7721800065040588\n",
      "Epoch 634. Avg accuracy 0.7709600082039834\n",
      "Epoch 635. Avg accuracy 0.7728800058364869\n",
      "Epoch 636. Avg accuracy 0.7765200033783912\n",
      "Epoch 637. Avg accuracy 0.7749200078845024\n",
      "Epoch 638. Avg accuracy 0.7746600091457367\n",
      "Epoch 639. Avg accuracy 0.7852800053358078\n",
      "Epoch 640. Avg accuracy 0.7893800064921379\n",
      "Epoch 641. Avg accuracy 0.7965800109505653\n",
      "Epoch 642. Avg accuracy 0.7995600101351737\n",
      "Epoch 643. Avg accuracy 0.7933000081777573\n",
      "Epoch 644. Avg accuracy 0.7949000060558319\n",
      "Epoch 645. Avg accuracy 0.7980200129747391\n",
      "Epoch 646. Avg accuracy 0.7935000050067902\n",
      "Epoch 647. Avg accuracy 0.7977400109171867\n",
      "Epoch 648. Avg accuracy 0.7995000112056733\n",
      "Epoch 649. Avg accuracy 0.7991400080919265\n",
      "Epoch 650. Avg accuracy 0.7976400083303452\n",
      "Epoch 651. Avg accuracy 0.7954000073671341\n",
      "Epoch 652. Avg accuracy 0.7996200060844422\n",
      "Epoch 653. Avg accuracy 0.7978600093722343\n",
      "Epoch 654. Avg accuracy 0.80170000821352\n",
      "Epoch 655. Avg accuracy 0.7992600113153457\n",
      "Epoch 656. Avg accuracy 0.7991000083088875\n",
      "Epoch 657. Avg accuracy 0.7964000084996223\n",
      "Epoch 658. Avg accuracy 0.792480006814003\n",
      "Epoch 659. Avg accuracy 0.7980000111460686\n",
      "Epoch 660. Avg accuracy 0.7925600096583366\n",
      "Epoch 661. Avg accuracy 0.7956800037622451\n",
      "Epoch 662. Avg accuracy 0.7955800101161004\n",
      "Epoch 663. Avg accuracy 0.8063800135254859\n",
      "Epoch 664. Avg accuracy 0.8112200099229813\n",
      "Epoch 665. Avg accuracy 0.8100800082087517\n",
      "Epoch 666. Avg accuracy 0.8106800144910813\n",
      "Epoch 667. Avg accuracy 0.8075600099563599\n",
      "Epoch 668. Avg accuracy 0.800380008816719\n",
      "Epoch 669. Avg accuracy 0.8066000068187713\n",
      "Epoch 670. Avg accuracy 0.8095400115847587\n",
      "Epoch 671. Avg accuracy 0.8156600108742714\n",
      "Epoch 672. Avg accuracy 0.8229800063371658\n",
      "Epoch 673. Avg accuracy 0.8291200056672097\n",
      "Epoch 674. Avg accuracy 0.8285200083255768\n",
      "Epoch 675. Avg accuracy 0.8279400116205216\n",
      "Epoch 676. Avg accuracy 0.8312200084328651\n",
      "Epoch 677. Avg accuracy 0.8323000076413155\n",
      "Epoch 678. Avg accuracy 0.830340006351471\n",
      "Epoch 679. Avg accuracy 0.8381200063228608\n",
      "Epoch 680. Avg accuracy 0.8423200118541717\n",
      "Epoch 681. Avg accuracy 0.845920005440712\n",
      "Epoch 682. Avg accuracy 0.8471200108528137\n",
      "Epoch 683. Avg accuracy 0.8470600074529648\n",
      "Epoch 684. Avg accuracy 0.8514200058579445\n",
      "Epoch 685. Avg accuracy 0.8523400124907493\n",
      "Epoch 686. Avg accuracy 0.8547600099444389\n",
      "Epoch 687. Avg accuracy 0.8471400073170662\n",
      "Epoch 688. Avg accuracy 0.8480800113081932\n",
      "Epoch 689. Avg accuracy 0.8381000059843063\n",
      "Epoch 690. Avg accuracy 0.8384400102496147\n",
      "Epoch 691. Avg accuracy 0.833540013730526\n",
      "Epoch 692. Avg accuracy 0.8303200104832649\n",
      "Epoch 693. Avg accuracy 0.8264800053834915\n",
      "Epoch 694. Avg accuracy 0.8240600070357322\n",
      "Epoch 695. Avg accuracy 0.8282400047779084\n",
      "Epoch 696. Avg accuracy 0.8237600088119507\n",
      "Epoch 697. Avg accuracy 0.821040009856224\n",
      "Epoch 698. Avg accuracy 0.8205000054836273\n",
      "Epoch 699. Avg accuracy 0.8196600109338761\n",
      "Epoch 700. Avg accuracy 0.8208800080418587\n",
      "Epoch 701. Avg accuracy 0.8262800058722496\n",
      "Epoch 702. Avg accuracy 0.825020007789135\n",
      "Epoch 703. Avg accuracy 0.823540005683899\n",
      "Epoch 704. Avg accuracy 0.8254600074887276\n",
      "Epoch 705. Avg accuracy 0.8298600101470948\n",
      "Epoch 706. Avg accuracy 0.8271400114893913\n",
      "Epoch 707. Avg accuracy 0.8247000083327294\n",
      "Epoch 708. Avg accuracy 0.8228400066494942\n",
      "Epoch 709. Avg accuracy 0.825540012717247\n",
      "Epoch 710. Avg accuracy 0.8201200088858605\n",
      "Epoch 711. Avg accuracy 0.823560012280941\n",
      "Epoch 712. Avg accuracy 0.8231000074744225\n",
      "Epoch 713. Avg accuracy 0.8188400042057037\n",
      "Epoch 714. Avg accuracy 0.8163600096106529\n",
      "Epoch 715. Avg accuracy 0.8242200151085853\n",
      "Epoch 716. Avg accuracy 0.8280000078678131\n",
      "Epoch 717. Avg accuracy 0.8320000049471855\n",
      "Epoch 718. Avg accuracy 0.834780005812645\n",
      "Epoch 719. Avg accuracy 0.8343000116944314\n",
      "Epoch 720. Avg accuracy 0.8360800078511238\n",
      "Epoch 721. Avg accuracy 0.8434800094366074\n",
      "Epoch 722. Avg accuracy 0.8457400071620941\n",
      "Epoch 723. Avg accuracy 0.8476800119876862\n",
      "Epoch 724. Avg accuracy 0.8482600072026253\n",
      "Epoch 725. Avg accuracy 0.8462800124287605\n",
      "Epoch 726. Avg accuracy 0.8444000089168548\n",
      "Epoch 727. Avg accuracy 0.8396000090241432\n",
      "Epoch 728. Avg accuracy 0.8384000089764595\n",
      "Epoch 729. Avg accuracy 0.839720006287098\n",
      "Epoch 730. Avg accuracy 0.8372000104188919\n",
      "Epoch 731. Avg accuracy 0.837580013871193\n",
      "Epoch 732. Avg accuracy 0.8321200054883957\n",
      "Epoch 733. Avg accuracy 0.8276000031828881\n",
      "Epoch 734. Avg accuracy 0.8266200071573258\n",
      "Epoch 735. Avg accuracy 0.8352000108361244\n",
      "Epoch 736. Avg accuracy 0.8432600119709969\n",
      "Epoch 737. Avg accuracy 0.8510000115633011\n",
      "Epoch 738. Avg accuracy 0.8534000065922737\n",
      "Epoch 739. Avg accuracy 0.8602000123262405\n",
      "Epoch 740. Avg accuracy 0.8625800094008446\n",
      "Epoch 741. Avg accuracy 0.8679400101304054\n",
      "Epoch 742. Avg accuracy 0.8681400126218796\n",
      "Epoch 743. Avg accuracy 0.8685800114274025\n",
      "Epoch 744. Avg accuracy 0.8718600171804428\n",
      "Epoch 745. Avg accuracy 0.8696000090241433\n",
      "Epoch 746. Avg accuracy 0.8721800139546394\n",
      "Epoch 747. Avg accuracy 0.8757000121474267\n",
      "Epoch 748. Avg accuracy 0.8754800149798393\n",
      "Epoch 749. Avg accuracy 0.8814600136876106\n",
      "Epoch 750. Avg accuracy 0.8778000164031983\n",
      "Epoch 751. Avg accuracy 0.8774600142240524\n",
      "Epoch 752. Avg accuracy 0.8770000150799752\n",
      "Epoch 753. Avg accuracy 0.8785400179028511\n",
      "Epoch 754. Avg accuracy 0.8763000175356865\n",
      "Epoch 755. Avg accuracy 0.8740200152993203\n",
      "Epoch 756. Avg accuracy 0.8762800166010857\n",
      "Epoch 757. Avg accuracy 0.8767000171542167\n",
      "Epoch 758. Avg accuracy 0.8807400178909301\n",
      "Epoch 759. Avg accuracy 0.8763800159096717\n",
      "Epoch 760. Avg accuracy 0.876640014052391\n",
      "Epoch 761. Avg accuracy 0.8814400163292885\n",
      "Epoch 762. Avg accuracy 0.8798400127887726\n",
      "Epoch 763. Avg accuracy 0.8810600152611733\n",
      "Epoch 764. Avg accuracy 0.8837400153279305\n",
      "Epoch 765. Avg accuracy 0.8826000189781189\n",
      "Epoch 766. Avg accuracy 0.8842600208520889\n",
      "Epoch 767. Avg accuracy 0.881220016181469\n",
      "Epoch 768. Avg accuracy 0.8795600178837776\n",
      "Epoch 769. Avg accuracy 0.8795400193333626\n",
      "Epoch 770. Avg accuracy 0.8727200189232827\n",
      "Epoch 771. Avg accuracy 0.87754001557827\n",
      "Epoch 772. Avg accuracy 0.8809400156140328\n",
      "Epoch 773. Avg accuracy 0.8875800195336342\n",
      "Epoch 774. Avg accuracy 0.8867000216245651\n",
      "Epoch 775. Avg accuracy 0.8868000173568725\n",
      "Epoch 776. Avg accuracy 0.8887400183081627\n",
      "Epoch 777. Avg accuracy 0.8849600175023079\n",
      "Epoch 778. Avg accuracy 0.8831400164961815\n",
      "Epoch 779. Avg accuracy 0.8718800157308578\n",
      "Epoch 780. Avg accuracy 0.8688600176572799\n",
      "Epoch 781. Avg accuracy 0.8658600106835366\n",
      "Epoch 782. Avg accuracy 0.8737400156259537\n",
      "Epoch 783. Avg accuracy 0.8754800152778626\n",
      "Epoch 784. Avg accuracy 0.8725800135731697\n",
      "Epoch 785. Avg accuracy 0.8755600181221962\n",
      "Epoch 786. Avg accuracy 0.8820800185203552\n",
      "Epoch 787. Avg accuracy 0.8842200151085854\n",
      "Epoch 788. Avg accuracy 0.8831200158596039\n",
      "Epoch 789. Avg accuracy 0.8898400184512139\n",
      "Epoch 790. Avg accuracy 0.8894400200247765\n",
      "Epoch 791. Avg accuracy 0.8947200229763985\n",
      "Epoch 792. Avg accuracy 0.8957600209116936\n",
      "Epoch 793. Avg accuracy 0.9022000241279602\n",
      "Epoch 794. Avg accuracy 0.9046800261735917\n",
      "Epoch 795. Avg accuracy 0.9049000275135041\n",
      "Epoch 796. Avg accuracy 0.9111000281572342\n",
      "Epoch 797. Avg accuracy 0.9112800282239913\n",
      "Epoch 798. Avg accuracy 0.9152200356125831\n",
      "Epoch 799. Avg accuracy 0.9145600327849388\n",
      "Epoch 800. Avg accuracy 0.9153200277686119\n",
      "Epoch 801. Avg accuracy 0.9156000301241874\n",
      "Epoch 802. Avg accuracy 0.9131000277400017\n",
      "Epoch 803. Avg accuracy 0.9162200334668159\n",
      "Epoch 804. Avg accuracy 0.914380026459694\n",
      "Epoch 805. Avg accuracy 0.9174600347876549\n",
      "Epoch 806. Avg accuracy 0.9126200324296951\n",
      "Epoch 807. Avg accuracy 0.9159600305557251\n",
      "Epoch 808. Avg accuracy 0.9162000322341919\n",
      "Epoch 809. Avg accuracy 0.917740027308464\n",
      "Epoch 810. Avg accuracy 0.9154200327396392\n",
      "Epoch 811. Avg accuracy 0.9143200314044952\n",
      "Epoch 812. Avg accuracy 0.912300029695034\n",
      "Epoch 813. Avg accuracy 0.9100400277972222\n",
      "Epoch 814. Avg accuracy 0.9052200275659561\n",
      "Epoch 815. Avg accuracy 0.899420023560524\n",
      "Epoch 816. Avg accuracy 0.8952000194787979\n",
      "Epoch 817. Avg accuracy 0.892860018312931\n",
      "Epoch 818. Avg accuracy 0.8934800213575363\n",
      "Epoch 819. Avg accuracy 0.8961600181460381\n",
      "Epoch 820. Avg accuracy 0.896820020377636\n",
      "Epoch 821. Avg accuracy 0.8992400217056274\n",
      "Epoch 822. Avg accuracy 0.897720020711422\n",
      "Epoch 823. Avg accuracy 0.8978600153326988\n",
      "Epoch 824. Avg accuracy 0.9040200218558312\n",
      "Epoch 825. Avg accuracy 0.909500027000904\n",
      "Epoch 826. Avg accuracy 0.9123400273919106\n",
      "Epoch 827. Avg accuracy 0.91086002856493\n",
      "Epoch 828. Avg accuracy 0.9120000278949738\n",
      "Epoch 829. Avg accuracy 0.9110000303387642\n",
      "Epoch 830. Avg accuracy 0.9084000277519226\n",
      "Epoch 831. Avg accuracy 0.9052800273895264\n",
      "Epoch 832. Avg accuracy 0.904500022828579\n",
      "Epoch 833. Avg accuracy 0.9074200254678726\n",
      "Epoch 834. Avg accuracy 0.9186200308799743\n",
      "Epoch 835. Avg accuracy 0.9164000326395034\n",
      "Epoch 836. Avg accuracy 0.9199800291657447\n",
      "Epoch 837. Avg accuracy 0.9231600332260131\n",
      "Epoch 838. Avg accuracy 0.9254000380635261\n",
      "Epoch 839. Avg accuracy 0.9229000341892243\n",
      "Epoch 840. Avg accuracy 0.9215200299024582\n",
      "Epoch 841. Avg accuracy 0.9224000352621079\n",
      "Epoch 842. Avg accuracy 0.922480036020279\n",
      "Epoch 843. Avg accuracy 0.9228800314664841\n",
      "Epoch 844. Avg accuracy 0.9224200338125229\n",
      "Epoch 845. Avg accuracy 0.9209200346469879\n",
      "Epoch 846. Avg accuracy 0.9223200356960297\n",
      "Epoch 847. Avg accuracy 0.9258600389957428\n",
      "Epoch 848. Avg accuracy 0.9287400418519973\n",
      "Epoch 849. Avg accuracy 0.9326000407338142\n",
      "Epoch 850. Avg accuracy 0.9335800421237945\n",
      "Epoch 851. Avg accuracy 0.9367000424861908\n",
      "Epoch 852. Avg accuracy 0.9340200418233872\n",
      "Epoch 853. Avg accuracy 0.9313200429081917\n",
      "Epoch 854. Avg accuracy 0.9293600413203239\n",
      "Epoch 855. Avg accuracy 0.9252600359916687\n",
      "Epoch 856. Avg accuracy 0.916000035405159\n",
      "Epoch 857. Avg accuracy 0.9203600347042084\n",
      "Epoch 858. Avg accuracy 0.9272800388932229\n",
      "Epoch 859. Avg accuracy 0.9292200356721878\n",
      "Epoch 860. Avg accuracy 0.9288400420546532\n",
      "Epoch 861. Avg accuracy 0.9292800426483154\n",
      "Epoch 862. Avg accuracy 0.9371600469946861\n",
      "Epoch 863. Avg accuracy 0.939580046236515\n",
      "Epoch 864. Avg accuracy 0.936960043311119\n",
      "Epoch 865. Avg accuracy 0.9385200470685959\n",
      "Epoch 866. Avg accuracy 0.9383400458097458\n",
      "Epoch 867. Avg accuracy 0.9397200468182564\n",
      "Epoch 868. Avg accuracy 0.9425600463151932\n",
      "Epoch 869. Avg accuracy 0.9443000504374504\n",
      "Epoch 870. Avg accuracy 0.942820051908493\n",
      "Epoch 871. Avg accuracy 0.9438600507378578\n",
      "Epoch 872. Avg accuracy 0.943980048596859\n",
      "Epoch 873. Avg accuracy 0.9435600486397743\n",
      "Epoch 874. Avg accuracy 0.9405000478029251\n",
      "Epoch 875. Avg accuracy 0.9386600470542907\n",
      "Epoch 876. Avg accuracy 0.9409400469064713\n",
      "Epoch 877. Avg accuracy 0.940360044836998\n",
      "Epoch 878. Avg accuracy 0.9393800479173661\n",
      "Epoch 879. Avg accuracy 0.9406800493597984\n",
      "Epoch 880. Avg accuracy 0.9423200455307961\n",
      "Epoch 881. Avg accuracy 0.9423800480365753\n",
      "Epoch 882. Avg accuracy 0.9445000487565994\n",
      "Epoch 883. Avg accuracy 0.9447200477123261\n",
      "Epoch 884. Avg accuracy 0.9450000500679017\n",
      "Epoch 885. Avg accuracy 0.9486600509285927\n",
      "Epoch 886. Avg accuracy 0.9473400500416755\n",
      "Epoch 887. Avg accuracy 0.9478800538182258\n",
      "Epoch 888. Avg accuracy 0.9474400514364243\n",
      "Epoch 889. Avg accuracy 0.9479600527882576\n",
      "Epoch 890. Avg accuracy 0.9507400485873222\n",
      "Epoch 891. Avg accuracy 0.9473800507187843\n",
      "Epoch 892. Avg accuracy 0.9499000510573388\n",
      "Epoch 893. Avg accuracy 0.9539200574159622\n",
      "Epoch 894. Avg accuracy 0.9548000574111939\n",
      "Epoch 895. Avg accuracy 0.953800056874752\n",
      "Epoch 896. Avg accuracy 0.9575400602817535\n",
      "Epoch 897. Avg accuracy 0.955940057337284\n",
      "Epoch 898. Avg accuracy 0.9565000599622726\n",
      "Epoch 899. Avg accuracy 0.9558600577712059\n",
      "Epoch 900. Avg accuracy 0.9564600598812103\n",
      "Epoch 901. Avg accuracy 0.9571200567483902\n",
      "Epoch 902. Avg accuracy 0.9529600566625596\n",
      "Epoch 903. Avg accuracy 0.9513800510764122\n",
      "Epoch 904. Avg accuracy 0.9507800540328026\n",
      "Epoch 905. Avg accuracy 0.9491400516033173\n",
      "Epoch 906. Avg accuracy 0.9502600532770157\n",
      "Epoch 907. Avg accuracy 0.9547800531983376\n",
      "Epoch 908. Avg accuracy 0.9584600579738617\n",
      "Epoch 909. Avg accuracy 0.9575600609183311\n",
      "Epoch 910. Avg accuracy 0.9582000601291657\n",
      "Epoch 911. Avg accuracy 0.958460057079792\n",
      "Epoch 912. Avg accuracy 0.9595000559091568\n",
      "Epoch 913. Avg accuracy 0.9600400608778\n",
      "Epoch 914. Avg accuracy 0.95998006016016\n",
      "Epoch 915. Avg accuracy 0.9577600589394569\n",
      "Epoch 916. Avg accuracy 0.9558800581097603\n",
      "Epoch 917. Avg accuracy 0.9552000612020493\n",
      "Epoch 918. Avg accuracy 0.9559600594639778\n",
      "Epoch 919. Avg accuracy 0.9577200600504875\n",
      "Epoch 920. Avg accuracy 0.952880057990551\n",
      "Epoch 921. Avg accuracy 0.9542800581455231\n",
      "Epoch 922. Avg accuracy 0.9539200592041016\n",
      "Epoch 923. Avg accuracy 0.9520800572633743\n",
      "Epoch 924. Avg accuracy 0.9549000576138497\n",
      "Epoch 925. Avg accuracy 0.9553600585460663\n",
      "Epoch 926. Avg accuracy 0.9591000607609749\n",
      "Epoch 927. Avg accuracy 0.9600000610947609\n",
      "Epoch 928. Avg accuracy 0.9614600625634193\n",
      "Epoch 929. Avg accuracy 0.9614600631594657\n",
      "Epoch 930. Avg accuracy 0.9626800581812859\n",
      "Epoch 931. Avg accuracy 0.9627600625157356\n",
      "Epoch 932. Avg accuracy 0.9631400635838508\n",
      "Epoch 933. Avg accuracy 0.9621200615167618\n",
      "Epoch 934. Avg accuracy 0.9634000620245934\n",
      "Epoch 935. Avg accuracy 0.9637800645828247\n",
      "Epoch 936. Avg accuracy 0.9631000626087188\n",
      "Epoch 937. Avg accuracy 0.9627400618791581\n",
      "Epoch 938. Avg accuracy 0.9639600610733032\n",
      "Epoch 939. Avg accuracy 0.9629800599813462\n",
      "Epoch 940. Avg accuracy 0.9638800632953644\n",
      "Epoch 941. Avg accuracy 0.9634800615906716\n",
      "Epoch 942. Avg accuracy 0.9636400610208511\n",
      "Epoch 943. Avg accuracy 0.9654200634360314\n",
      "Epoch 944. Avg accuracy 0.9664400652050972\n",
      "Epoch 945. Avg accuracy 0.9639800611138344\n",
      "Epoch 946. Avg accuracy 0.9654000669717788\n",
      "Epoch 947. Avg accuracy 0.9642200616002082\n",
      "Epoch 948. Avg accuracy 0.9637600600719451\n",
      "Epoch 949. Avg accuracy 0.9653400653600692\n",
      "Epoch 950. Avg accuracy 0.9628400617837906\n",
      "Epoch 951. Avg accuracy 0.9647800654172898\n",
      "Epoch 952. Avg accuracy 0.9633200594782829\n",
      "Epoch 953. Avg accuracy 0.9648200613260269\n",
      "Epoch 954. Avg accuracy 0.9629600659012795\n",
      "Epoch 955. Avg accuracy 0.9654200619459152\n",
      "Epoch 956. Avg accuracy 0.9699200651049614\n",
      "Epoch 957. Avg accuracy 0.9721800673007965\n",
      "Epoch 958. Avg accuracy 0.9746000698208809\n",
      "Epoch 959. Avg accuracy 0.9770400705933571\n",
      "Epoch 960. Avg accuracy 0.9776600757241249\n",
      "Epoch 961. Avg accuracy 0.9749400696158409\n",
      "Epoch 962. Avg accuracy 0.9779200735688209\n",
      "Epoch 963. Avg accuracy 0.9790200716257096\n",
      "Epoch 964. Avg accuracy 0.9787200731039047\n",
      "Epoch 965. Avg accuracy 0.9792000710964203\n",
      "Epoch 966. Avg accuracy 0.9784600737690926\n",
      "Epoch 967. Avg accuracy 0.9780200710892677\n",
      "Epoch 968. Avg accuracy 0.9805400770902634\n",
      "Epoch 969. Avg accuracy 0.9795400735735893\n",
      "Epoch 970. Avg accuracy 0.9814200782775879\n",
      "Epoch 971. Avg accuracy 0.9811400762200355\n",
      "Epoch 972. Avg accuracy 0.9800800731778145\n",
      "Epoch 973. Avg accuracy 0.9774800708889961\n",
      "Epoch 974. Avg accuracy 0.9803200751543045\n",
      "Epoch 975. Avg accuracy 0.979080071747303\n",
      "Epoch 976. Avg accuracy 0.981040073633194\n",
      "Epoch 977. Avg accuracy 0.9833200788497924\n",
      "Epoch 978. Avg accuracy 0.9813600778579712\n",
      "Epoch 979. Avg accuracy 0.9804200717806816\n",
      "Epoch 980. Avg accuracy 0.9799800744652748\n",
      "Epoch 981. Avg accuracy 0.9808400776982308\n",
      "Epoch 982. Avg accuracy 0.9797600722312927\n",
      "Epoch 983. Avg accuracy 0.9800400713086128\n",
      "Epoch 984. Avg accuracy 0.9812000769376755\n",
      "Epoch 985. Avg accuracy 0.9785000705718994\n",
      "Epoch 986. Avg accuracy 0.981900078356266\n",
      "Epoch 987. Avg accuracy 0.9816200771927833\n",
      "Epoch 988. Avg accuracy 0.9835000810027122\n",
      "Epoch 989. Avg accuracy 0.9826000729203224\n",
      "Epoch 990. Avg accuracy 0.9847400805354118\n",
      "Epoch 991. Avg accuracy 0.9827200731635094\n",
      "Epoch 992. Avg accuracy 0.9820200744271278\n",
      "Epoch 993. Avg accuracy 0.9833200764656067\n",
      "Epoch 994. Avg accuracy 0.9815400755405426\n",
      "Epoch 995. Avg accuracy 0.982320077419281\n",
      "Epoch 996. Avg accuracy 0.9856000789999961\n",
      "Epoch 997. Avg accuracy 0.9844000786542892\n",
      "Epoch 998. Avg accuracy 0.9846800771355629\n",
      "Epoch 999. Avg accuracy 0.9809800750017166\n"
     ]
    }
   ],
   "source": [
    "with tf.Session() as sess:\n",
    "    sess.run(tf.global_variables_initializer())\n",
    "    onehot_labels = tf.one_hot(labels, len(names), on_value=1., off_value=0., axis=-1)\n",
    "    onehot_vals = sess.run(onehot_labels)\n",
    "    batch_size = len(data) // 200\n",
    "    print('batch size', batch_size)\n",
    "    for j in range(0, 1000):\n",
    "        avg_accuracy_val = 0.\n",
    "        batch_count = 0.\n",
    "        for i in range(0, len(data), batch_size):\n",
    "            batch_data = data[i:i+batch_size, :]\n",
    "            batch_onehot_vals = onehot_vals[i:i+batch_size, :]\n",
    "            _, accuracy_val = sess.run([train_op, accuracy], feed_dict={x: batch_data, y: batch_onehot_vals})\n",
    "            avg_accuracy_val += accuracy_val\n",
    "            batch_count += 1.\n",
    "        avg_accuracy_val /= batch_count\n",
    "        print('Epoch {}. Avg accuracy {}'.format(j, avg_accuracy_val))\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
